// Tradex.Connectivity.Rithmic.h

#pragma once

#include "vcclr.h"
#include "NxCoreAPI.h"
#include "NativeConnector.h"

using namespace System;
using namespace System::Collections::Generic;
using namespace System::Data::Common;
using namespace System::IO;
using namespace System::Reflection;

using namespace Tradex;
using namespace Tradex::Market;
using namespace Tradex::Trading;
using namespace Tradex::Connectivity::ConnectorModel;

namespace Tradex {
	namespace Connectivity {
		namespace NxCore {

			class NativeConnector;

			public ref class NxCoreConnector :
				IConnector
				//IMarketConnector,
				//ITradingConnector
			{

				public:

				[System::Security::SecurityCritical()]
				NxCoreConnector ();

				[System::Security::SecurityCritical()]
				~NxCoreConnector ();

				// IConnector - start

				[System::Security::SecurityCritical()]
				virtual void SetCallback(IConnectorCallback^ callback);

				[System::Security::SecurityCritical()]
				virtual void Connect (String^ connectionString);
				
				[System::Security::SecurityCritical()]
				virtual void Disconnect ();
				
				[System::Security::SecurityCritical()]
				virtual property bool IsConnected { bool get(); }

				[System::Security::SecuritySafeCritical()]
				void OnLogEntry (
					System::Diagnostics::TraceLevel traceLevel,
					String^ subject,
					String^ message,
					String^ origin,
					String^ reference
				);

				[System::Security::SecuritySafeCritical()]
				void OnStatusUpdate (
					ConnectionStatusCode code,
					String^ message
				);

				// IConnector - end

				// IMarketConnector - start

				[System::Security::SecuritySafeCritical()]
				virtual void SetCallback(IMarketConnectorCallback^ callback);

				[System::Security::SecurityCritical()]
				virtual void Subscribe (InstrumentKey^ instrument, ActivityFilters filter);

				[System::Security::SecurityCritical()]
				virtual void Subscribe (MarketKey^ market, ActivityFilters filter);

				[System::Security::SecurityCritical()]
				virtual void GetReferenceData (InstrumentKey^ instrument);

				[System::Security::SecuritySafeCritical()]
				void OnActivity (InstrumentKey^ instrument, Activity^ activity);

				[System::Security::SecuritySafeCritical()]
				void OnReferenceUpdate (InstrumentKey^ instrument, InstrumentInfo^ instrumentInfo, InstrumentPricing^ instrumentPricing);

				// IMarketConnector - end

				private:
				NativeConnector* pNative;

				IConnectorCallback^ pConnectorCallback;

				IMarketConnectorCallback^ pMarketConnectorCallback;

			};

		}
	}
}
